<?php
use think\Model;
class Foods extends Model {
    protected $pk = 'id';
    public function getStatusAttr($value)
    {
        $status = [1=>'在售',2=>'下架'];
        return $status[$value];
    }
    public function getFinfo()
    {
        return $this->paginate(10);
    }

    public function getFdata($row)
    {
        return $this->find();
    }

    public function getupFoods($id)
    {
        return $this->where('id',$id)->find();
    }
    public function updateFood($data){
        return $this->isUpdate(true)->save($data);
    }
    public function findFood($no)
    {
        return $this->where('cid',$no)->find();
    }
    public function delFood($id)
    {
        return $this->where('id',$id)->delete();
    }

    public function getevF($row)
    {
        return $this->field('name',$row)->find();
    }

}